package com.woniuxy.service.impl;

import com.woniuxy.dao.K15TeacherDao;
import com.woniuxy.entity.K15Teacher;
import com.woniuxy.service.K15TeacherService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


/**
 * (K15Teacher)表服务实现类
 *
 * @author makejava
 * @since 2021-04-25 23:04:52
 */
@Service("k15TeacherService")
public class K15TeacherServiceImpl implements K15TeacherService {
    @Resource
    private K15TeacherDao k15TeacherDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public K15Teacher queryById(Integer id) {
        return this.k15TeacherDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<K15Teacher> queryAllByLimit(int offset, int limit) {
        return this.k15TeacherDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param k15Teacher 实例对象
     * @return 实例对象
     */
    @Override
    public K15Teacher insert(K15Teacher k15Teacher) {
        this.k15TeacherDao.insert(k15Teacher);
        return k15Teacher;
    }

    /**
     * 修改数据
     *
     * @param k15Teacher 实例对象
     * @return 实例对象
     */
    @Override
    public K15Teacher update(K15Teacher k15Teacher) {
        this.k15TeacherDao.update(k15Teacher);
        return this.queryById(k15Teacher.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.k15TeacherDao.deleteById(id) > 0;
    }
}
